<template>
  <div>
    <pie-chart-rose
      ref="sourceTypeAnalysis"
      :height="height"
      :opinionSeriesData="sourceTypeAnalysis"
      :saveImage="true"
      @getBase64Image="getBase64Image"
    />
  </div>
</template>
<script>
  import {
    getMediaTypeAnalysis,
  } from "@/api/system/reportGenerate";
  import PieChartRose from '@/components/Echarts/PieChartRose'

export default {
  props: {
    eventId: {
        type: Number,
        default: 0
      },

  },
  data() {
    return {
      sourceTypeAnalysis: [],
      height: "476px",
      loading: true,

    }
  },
  components:{
    PieChartRose,
  },
  computed: {
  },
  watch: {},
  mounted() {
    this.getMediaTypeAnalysis()
  },
  created() {

  },
  methods: {
    getBase64Image(val) {
      this.$emit('getBase64Image', val)
    },

    getMediaTypeAnalysis() {
      this.loading = true;
      getMediaTypeAnalysis(this.eventId).then(response => {
        this.loading = false;
        //来源类型分析
        this.sourceTypeAnalysis = response.data
        //渲染玫瑰图
        this.$refs.sourceTypeAnalysis.initChart();
      });
    },

  }
}
</script>

